import { View, PageContainer, Text } from "@tarojs/components";

type Props = {
  visible: boolean;
  onCancel: () => void;
  onConfirm: () => void;
  children: React.ReactNode;
};

const GlobalPopup = ({ visible, onCancel, onConfirm, children }: Props) => {
  console.log(visible);
  return (
    <PageContainer show={visible} className="global-popup" round>
      <View onClick={onCancel}>
        <View className="global-popup-header">
          <Text className="cancel" onClick={onCancel}>
            取消
          </Text>
          <Text className="confirm" onClick={onConfirm}>
            确定
          </Text>
        </View>
        <View className="global-popup-content">{children}</View>
      </View>
    </PageContainer>
  );
};

export default GlobalPopup;
